/** 
 * Project Name:ZhiWeiCateringManagementSystem 
 * File Name:DishOrderRecordItemAction.java 
 * Package Name:cn.ccit.servers 
 * Date:2016年11月5日下午7:18:38 
 * Copyright (c) 2016, 120026139@qq.com All Rights Reserved. 
 * 
*/  
  
package cn.ccit.action;  

import java.util.List;

import com.opensymphony.xwork2.ModelDriven;

import cn.ccit.entites.record.DishOrderRecordItem;
import cn.ccit.iservers.IDishOrderRecordItemServers;
import cn.ccit.model.BaseModel;
import cn.ccit.servers.DishOrderRecordItemServers;

/** 
 * ClassName:DishOrderRecordItemAction <br/> 
 * Function: 退菜记录表 <br/> 
 * Reason:    <br/> 
 * Date:     2016年11月5日 下午7:18:38 <br/> 
 * @author   Administrator 
 * @version   
 * @since    JDK 1.6 
 * @see       
 */
public class DishOrderRecordItemAction extends BaseRecordAction implements ModelDriven<DishOrderRecordItem>{
	
	/** 
	 * serialVersionUID:(版本号). 
	 * @since JDK 1.6 
	 */   
	private static final long serialVersionUID = 1L;
	private IDishOrderRecordItemServers dishOrderItemServers =new DishOrderRecordItemServers();
	private DishOrderRecordItem dishOrderItem =new DishOrderRecordItem();
	private String reason;
	@Override
	public String addData() {
		sendJsonData(dishOrderItemServers.addDishOrderRecordItem(dishOrderItem), new BaseModel<DishOrderRecordItem>());
		return super.addData();
	}

	@Override
	public String removeData() {
		sendJsonData(dishOrderItemServers.removeDishOrderRecordItem(dishOrderItem), new BaseModel<DishOrderRecordItem>());
		return super.removeData();
	}

	@Override
	public String changeDataInfo() {
		sendJsonData(dishOrderItemServers.changeDishOrderRecordItemInfo(dishOrderItem), new BaseModel<DishOrderRecordItem>());
		return super.changeDataInfo();
	}

	@Override
	public String getDataList() {
		sendJsonDataList(dishOrderItemServers.getSomeDishOrderRecordItems(startId, limit), 
				new BaseModel<List<DishOrderRecordItem>>());
		return super.getDataList();
	}

	@Override
	public String sreachDataById() {
		DishOrderRecordItem di=dishOrderItemServers.searchDishOrderRecordItemByID(dishOrderItem.getId());
		sendJsonData(di!=null,
				new BaseModel<DishOrderRecordItem>(),
				di);
		return super.sreachDataById();
	}

	

	@Override
	public DishOrderRecordItem getModel() {
		return dishOrderItem;
	}

	@Override
	public String searchDataListByYear() {
		sendJsonDataList(dishOrderItemServers.searchDishOrderRecordItemByYear(dishOrderItem.getOrderYear()),
				new BaseModel<List<DishOrderRecordItem>>());
		return super.searchDataListByYear();
	}

	@Override
	public String searchDataListByMonth() {
		sendJsonDataList(dishOrderItemServers.searchDishOrderRecordItemByMonth(dishOrderItem.getOrderMonth()),
				new BaseModel<List<DishOrderRecordItem>>());
		return super.searchDataListByMonth();
	}

	@Override
	public String searchDataListByDate() {
		sendJsonDataList(dishOrderItemServers.searchDishOrderRecordItemByDate(dishOrderItem.getOrderDate()),
				new BaseModel<List<DishOrderRecordItem>>());
		return super.searchDataListByDate();
	}

	@Override
	public String searchDataListBySerialsNumber() {
		sendJsonDataList(dishOrderItemServers.
				searchDishOrderRecordItemBySerialsNumber(dishOrderItem.getSerialsNumber()),
				new BaseModel<List<DishOrderRecordItem>>());
		return super.searchDataListBySerialsNumber();
	}

	@Override
	public String changeDataState() {
		sendJsonData(
				dishOrderItemServers.changeDataEnum(dishOrderItem, reason), 
				new BaseModel<DishOrderRecordItem>());
		return super.changeDataState();
	}

	public String getReason() {
		return reason;
	}

	public void setReason(String reason) {
		this.reason = reason;
	}

	
	
	
}
